﻿using IntelligentAgriculture.Contracts.Dto.Output;
using IntelligentAgriculture.Contracts.Interface;
using IntelligentAgriculture.Services;
using IntelligentAgriculture.WebAPI.Application.Command.DepartMentCommand;
using IntelligentAgriculture.WebAPI.Application.Command.SheepCommand;
using IntelligentAgriculture.WebAPI.Application.CommandHandler.SheepCommandHandler;
using MediatR;

namespace IntelligentAgriculture.WebAPI.Application.CommandHandler.DepartMentCommandHandler
{
    public class DepartMentQueryCommandHandler : IRequestHandler<DepartMentQueryCommand, Results<PageOutput<DepartMentOutPut>>>
    {

        private readonly IDepartMentService departService;
        private readonly ILogger<DepartMentQueryCommandHandler> logger;
        public DepartMentQueryCommandHandler(IDepartMentService departService, ILogger<DepartMentQueryCommandHandler> logger)
        {
            this.departService = departService;
            this.logger = logger;
        }
        /// <summary>
        /// 部门查询列表
        /// </summary>
        /// <param name="request"></param>
        /// <param name="cancellationToken"></param>
        /// <returns></returns>
        public async Task<Results<PageOutput<DepartMentOutPut>>> Handle(DepartMentQueryCommand request, CancellationToken cancellationToken)
        {
            var list = await departService.DepartMnetList(request.Depart);
            var results = Results<PageOutput<DepartMentOutPut>>.DataResult(list);
            return results;
        }






    }





}
